package org.grow.loginto.entity.enums;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.stream.Collectors;

public enum ApplyState {
    saved("未提交"),submitted("已提交"),ended("已结束");
//用于给用户看
    private String text;

    ApplyState(String text) {
        this.text = text;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }
    public static List<Map<String,Object>> auditFullStates(){
        return Arrays.stream(ApplyState.values())
                .map(x -> {
                    TreeMap<String, Object> obj = new TreeMap<>();
                    obj.put("text", x.getText());
                    obj.put("value", x.name());
                    obj.put("index", x.ordinal());
                    return obj;
                }).collect(Collectors.toList());
    }
}
